package org.example.sale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Proxy;

/**
 * @className: Main
 * @Description:
 * @Author: wangyifei
 * @Date: 2025/3/12 11:11
 */
public class Main {
    private static Logger logger = LoggerFactory.getLogger(Main.class);

    public static void main(String[] args) {
        Factory factory = new Factory();

        Salable s = (Salable)Proxy.newProxyInstance(factory.getClass().getClassLoader(),
                factory.getClass().getInterfaces()
                , new AgentInvocationHandler(factory, new BeforeAfter() {
                    @Override
                    public void before() {
                        System.out.println("新疆售前 ");
                    }

                    @Override
                    public void after() {
                        System.out.println("新疆售后 ");
                    }
                }));

        s.sale();
    }
}
